<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>

<script type="text/javascript" src="lib/vue-2.6.10.js"></script>
<script type="text/javascript" src="lib/vue-resource.js"></script>

<body>
	
	<div id="app">
		<h1>{{ title }}</h1>
		
		<button @click="gets()">点击发送ajax -- get方法</button>
		<button @click="posts()">点击发送ajax -- post方法</button>

	</div>
	
	<script type="text/javascript">
		new Vue({
			el:"#app",
			data:{
				title:'交互',
				url1:'http://vue1906.strive1.top/vueapi/1.php',
				url2:'http://vue1906.strive1.top/vueapi/2.php',	
			},
			methods:{
				gets(){
					
					this.$http.get(this.url1,{a:10,b:20}).then(res=>{
						console.log(res.data);
					},err=>{
						console.log('你是谁')
					});

				},
				posts(){
					this.$http.post(this.url2,{a:100,b:200},{emulateJSON:true}).then(res=>{
						console.log(res.data);
					},err=>{
						console.log('你是谁')
					});

				}
			}
		})


	</script>

</body>
</html>